<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        body{
            background: #eeeeee;
        }
        .box{
            width: 400px;
            height: 30px;
            margin: 0 auto;
            position: relative;
            overflow: hidden;
        }

        ul{
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        li{
            width: 100px;
            height: 30px;
            line-height: 30px;
            list-style: none;
            text-align: center;

        }
        a{
            width: 100%;
            height: 30px;
            line-height: 30px;
            text-align: center;
            display: inline-block;
            text-decoration: none;
            z-index: 100;
        }
        .kuai{
            position: absolute;
            left: 0;
            transform: translateX(-100%);
            display: block;
            content: '';
            width: 100px;
            height: 30px;
            background: #FFFFFF;
            transition: all .3s linear;
            z-index: -1;
        }
        li:nth-of-type(1){
            border-top: 6px solid #f6c755;
        }
        li:nth-of-type(2){
            border-top: 6px solid #35b1ff;
        }
        li:nth-of-type(3){
            border-top: 6px solid #ff6700;
        }
        li:nth-of-type(4){
            border-top: 6px solid #74ae0d;
        }
        li:nth-of-type(1):hover~.kuai{
            transform: translateX(0px);
            background: #f6c755;
        }
        li:nth-of-type(2):hover~.kuai{
            transform: translateX(100px);
            background: #35b1ff;
        }
        li:nth-of-type(3):hover~.kuai{
            transform: translateX(200px);
            background: #ff6700;
        }
        li:nth-of-type(4):hover~.kuai{
            transform: translateX(300px);
            background: #74ae0d;
        }
    </style>
</head>
<body>
<div class="box">
    <ul>
        <li><a href="#">首页</a></li>
        <li><a href="#">首页</a></li>
        <li><a href="#">首页</a></li>
        <li><a href="#">首页</a></li>
        <li class="kuai"></li>
    </ul>
</div>
</body>
</html>